package wuji.demospringclouduserprovider.controller;

import org.apache.log4j.Logger;
import org.springframework.web.bind.annotation.*;
import wuji.pojo.User;
import wuji.service.UserService;


import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
public class UserController {

    @Resource
    private UserService userService ;

    @RequestMapping("/login")
    public User login(@RequestParam(name = "username")String username, @RequestParam(name = "password")String password) {
        System.out.println("访问UserService：login方法，端口8888");
        //int a = 1/0 ;
        return userService.login(username, password) ;
    }


    @RequestMapping("/user/userList")
    public List<User> userList() {
        /*try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
*/
        System.out.println("调用端口8885的userlist接口");
        return userService.userList() ;
    }
}
